package p5;

/**
 * @author krystal
 * @date 2022/11/10 13:45
 */
public class Demo5 {
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5,6,7};
        System.out.println(find(arr, 4));
    }

    public static int find(int[] arr,int data){
        for (int i = 0; i < arr.length; i++) {
            if(arr[i] == data){
                return i;
            }
        }
        return -1;
    }
}
